home *** CD-ROM | disk | FTP | other *** search
Wrap
/* Image Engineer ARexx macro script ** by Simon Edwards ** 27/4/95 ** Improved by Patrik M Nydensten ** 22/8 1996 Stockholm/Sweden */ /* Pixelizes the region marked out on a given project ** or the entire image if no box is selected. */ Options results if arg()==0 then exit 'PROJECT_INFO' arg(1) 'BOX' /* Get the dimensions of the box */ CropBox=RESULT signal on error /* Setup a place for errors to go */ if CropBox ~= 'RESULT' then do 'CROP' arg(1) CropBox /* Crop it */ CropPic=RESULT 'PROJECT_INFO' CropPic 'WIDTH' /* Get width of cropped image */ CropWidth=RESULT 'PROJECT_INFO' CropPic 'HEIGHT' /* Get height of cropped image */ CropHeight=RESULT nil = get_number() 'SCALE' CropPic trunc(CropWidth/PX) trunc(CropHeight/PY) 'FAST' LittleCrop=RESULT CLOSE CropPic 'SCALE' LittleCrop CropWidth CropHeight 'FAST' PixCrop=RESULT CLOSE LittleCrop 'MARK' PixCrop 'PRIMARY' 'MARK' arg(1) 'SECONDARY' 'COMPOSITE' WORD(CropBox,1) WORD(CropBox,2) MIX 100 CLOSE PixCrop end else do 'PROJECT_INFO' arg(1) 'WIDTH' /* Get width of image */ CropWidth=RESULT 'PROJECT_INFO' arg(1) 'HEIGHT' /* Get height of image */ CropHeight=RESULT nil = get_number() 'SCALE' arg(1) trunc(CropWidth/PX) trunc(CropHeight/PY) 'FAST' LittleCrop=RESULT 'SCALE' LittleCrop CropWidth CropHeight 'FAST' PixCrop=RESULT CLOSE LittleCrop end exit get_number: 'GET_NUMBER "Pixelize X (width) amount." 2' trunc(CropWidth/8) '" OK " 4' 'SLIDER' if RC=5 then exit PX = RESULT 'GET_NUMBER "Pixelize Y (height) amount." 2' trunc(CropHeight/8) '" Go! "' PX 'SLIDER' if RC=5 then exit PY = RESULT return '' /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do /* Did the user just cancel us? */ IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' exit end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' exit end